import request from "@/utils/http";
/**
 * 小程序登录
 * @param {string} encryptedData 加密的手机号信息 getphonenumber事件回调中获取
 * @param {string} iv 加密相关 getphonenumber事件回调中获取
 * @param {string} code 通过 wx.login() 获取
 */
export const loginByWXAPI = (data) => {
    return http({
        url: "/login/wxMin",
        method: "POST",
        data,
    });
};

// * 小程序登录  测试
export const loginByTestPhoneAPI = (phoneNumber) => {
    return request({
        url: "/login/wxMin/simple",
        method: "post",
        data: {
            phoneNumber,
        },
    });
};
/** 获取个人资料 */
export const getProfileAPI = () => request({ url: "/member/profile" });

/** 上传头像 */
export const uploadPhotoAPI = (filePath) => {
    return uni.uploadFile({
        url: "/member/profile/avatar",
        // 💥💥 不需要写post
        name: "file",
        // 💥💥 注意参数是一个临时路径
        filePath,
    });
};
// 修改性别
export const updateProfileAPI = (data) => {
    return request({ url: "/member/profile", method: "put", data });
};